﻿using Bilibili.Model.Common;
using System.Collections.Generic;
using System.Linq;

namespace Bilibili.WebClient
{
    public static class Untils
    {
        public static bool GetDashItem<T>(this ReturnPlayModel model, int index, out T item)
        {
            item = default;
            try
            {
                if (model.MediaSources is List<T> array)
                {
                    item = array.ElementAt(index);
                    return true;
                }
            }
            catch { }
            return false;
        }
    }
}